package com.yuwei.http

import com.yuwei.base.entity.Res
import com.yuwei.http.entity.*
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query


interface ApiService {
    @POST(Const.LOGIN_URL)
    suspend fun login(@Query("username")username : String,@Query("password")password : String): Res<UserEntity>
    @POST(Const.REGISTER_URL)
    suspend fun register(@Query("username")username : String,@Query("password")password : String): Res<UserEntity>
    @GET(Const.GET_NOTICE_URL)
    suspend fun getNotice(@Query("page")page : Int,@Query("size")size : Int) : Res<NoticeEntity>

    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getParking(@Path("areaId")areaId:Int):Res<ParkingEntity>

    @POST("/api/parking-spaces")
    suspend fun getAddParking(@Body addParkingEntity: AddParkingEntity):Res<AddParkingBodyEntity>

    @DELETE("/api/parking-spaces/{id}")
    suspend fun getDeleteParking(@Path("id")id:Int):Res<String>

    @GET("/api/visit-appointments")
    suspend fun getVisitor():Res<VisitorEntity>

    @GET("/api/patrol-tasks")
    suspend fun getInspection():Res<InspectionEntity>
    @GET("/api/patrol-points")
    suspend fun getPatrol():Res<PatrolEntity>

    @GET("/api/devices")
    suspend fun getDeviceList(): Res<DeviceEntity>
    @POST("/api/devices")
    suspend fun addDevice(@Body deviceEntityItem: DeviceEntityItem): Res<DeviceEntityItem>
    @GET("/api/repair-orders")
    suspend fun getOrders():Res<ordersEntity>

    @GET("/api/attendances/user/{userId}")
    suspend fun getAttendances(@Path("userId")userId:Int): Res<AttendancesEntity>
    @POST("/api/attendances")
    suspend fun sendAttendances(@Body sendAttendancesBody: SendAttendancesBody):Res<AttendancesEntityItem>

    @GET("/api/properties")
    suspend fun getProperties():Res<Properties>

    @POST("/api/visit-appointments")
    suspend fun getAddAppointments(@Body addAppointmentsBody: AddAppointmentsBody):Res<AddAppointmentEntity>

    @DELETE("/api/visit-appointments/{id}")
    suspend fun getDelete(@Path("id")id:Int):Res<String>

    @PATCH("/api/visit-appointments/reject/{id}")
    suspend fun getReject(@Path("id")id: Int):Res<RejectEntity>

    @PATCH("/api/visit-appointments/approve/{id}")
    suspend fun getApprove(@Path("id")id:Int):Res<RejectEntity>

    @POST("/api/repair-orders")
    suspend fun getAddOrders(@Body ordersBody: AddOrdersBody):Res<AddOrdersEntity>

    @DELETE("/api/repair-orders/{id}")
    suspend fun getDeleteOrders(@Path("id")id:Int):Res<String>

    @GET("/api/properties/region/{regionId}")
    suspend fun getRegion(@Path("regionId")regionId:Int):Res<PropertiesEntity>

    @GET("/api/enterprise-profiles")
    suspend fun getEnterprise():Res<EnterpriseEntity>

    @GET("/api/enterprise-profiles/{id}")
    suspend fun getEnterpriseId(@Path("id")id:Int):Res<EnterpriseDetailEntity>

    @GET("/api/parking-payments")
    suspend fun getCarPayments():Res<CarPaymentsEntity>

    @GET("/api/vehicles/getProvinces}")
    suspend fun getProvinces():Res<ProvincesEntity>

    @POST("/api/vehicles")
    suspend fun getVehicles(@Body vehiclesBody: VehiclesBody):Res<VehiclesEntity>

    @DELETE("/api/parking-payments/{id}")
    suspend fun getDeleteCar(@Path("id")id:Int):Res<String>

    @POST("/api/parking-payments")
    suspend fun getAddPayments(@Body addPaymentsBody: AddPaymentsBody):Res<AddPaymentsEntity>

    @GET("/memberships/{userId}")
    suspend fun getMember(@Path("userId") userId: Int):Res<MemberEntity>

}